package com.yqman.util;

import java.sql.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

public class DateTool {
	
	public static Date getCurrentDate(){
		Date date = new Date(System.currentTimeMillis());
		return date;
	}
	@SuppressWarnings("deprecation")
	public static Date increaseCurrentDate(Date source,int years){
		if(years<=0) throw new IllegalArgumentException("years must > 0");
		Date date = (Date) source.clone();
		date.setYear(date.getYear()+years);
		return date;
	}
	public static String toStringYYMMDD(Date source){
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
		String dateStr = df.format(source);
		return dateStr;
	}
}
